package org.scirp.ijmis.service.personpaper.impl;

import java.util.List;

import org.scirp.ijmis.po.personpaper.JournalOfPerson;
import org.scirp.ijmis.service.personpaper.IJournalOfPersonService;
import org.scirp.ijmis.dao.personpaper.IJournalOfPersonDAO;

public class JournalOfPersonServiceImpl implements IJournalOfPersonService {
	private IJournalOfPersonDAO journalOfPersonDAO;

	public Long countObject() {
		return journalOfPersonDAO.countObject();
	}

	public JournalOfPerson deleteJournalOfPerson(JournalOfPerson entity) {
		return journalOfPersonDAO.deleteJournalOfPerson(entity);
	}

	public long saveJournalOfPerson(JournalOfPerson entity) {
		return journalOfPersonDAO.saveJournalOfPerson(entity);
	}

	public List<JournalOfPerson> selectAll() {
		return journalOfPersonDAO.selectAll();
	}

	public JournalOfPerson selectById(Object id) {
		return journalOfPersonDAO.selectById(id);
	}
	public boolean deleteJournalOfPersonByPersonId(long personId){
		return journalOfPersonDAO.deleteJournalOfPersonByPersonId(personId);
	}
	public List<JournalOfPerson> selectJournalOfPersonByJournalId(Long journalId) {
		return journalOfPersonDAO.selectJournalOfPersonByJournalId(journalId);
	}

	public List<JournalOfPerson> selectJournalOfPersonByPersonId(Long personId) {
		return journalOfPersonDAO.selectJournalOfPersonByPersonId(personId);
	}

	public boolean updateJournalOfPerson(JournalOfPerson entity) {
		return journalOfPersonDAO.updateJournalOfPerson(entity);
	}
	public boolean updateJournalOfPerson(long journalId,List<JournalOfPerson> list,long roleId) {
		boolean flag=true; 
		flag=journalOfPersonDAO.deleteJournalOfPersonByJournalId(journalId,roleId);
		for (JournalOfPerson journalOfPerson : list) {
			if(!journalOfPersonDAO.updateJournalOfPerson(journalOfPerson)){
				flag=false;
			}
		}
		return flag;
	}
	@Override
	public boolean deleteJournalOfPersonByJournalId(long journalId,long roleId) {
		return journalOfPersonDAO.deleteJournalOfPersonByJournalId( journalId,roleId);
	}
	public IJournalOfPersonDAO getJournalOfPersonDAO() {
		return journalOfPersonDAO;
	}

	public void setJournalOfPersonDAO(IJournalOfPersonDAO journalOfPersonDAO) {
		this.journalOfPersonDAO = journalOfPersonDAO;
	}

}
